<template>
	<u-overlay :show="true" @click="close">
		<!-- <view class="aaa"> -->
		<view class="warp">
			
			<view class="rect" @tap.stop>
				<view class="front" :animation="animationData" style="transform: scale(0,0);">
					<!-- <u-icon @click="close" name="close-circle-fill" size="23" color="#C1C4CA" class="close"></u-icon>
					<view class="text-center title bold m-b-10 m-t-5">
						签到成功，获得 <text class="green"> {{signInData.stone}} </text>元石
					</view>
					<view class="text-center f-xs">
						连续签到 {{signInData.continue}} 天，明日签到 +{{signInData.tomorrowStone}} 元石
					</view>
					<view class="sign-image text-center">
						<image src="../../../static/yuanshi.png" mode=""></image>
					</view>
					<u-button color="#000000" size="large" shape="circle" @click="toCalendar">
						<text class="bold f-base">前往签到中心  获取更多元石</text>
					</u-button> -->
				</view>
				<!-- <view class="back"></view> -->
			</view>
		</view>
		</view>
	</u-overlay>
</template>

<script>
	export default {
		props: {
			show: {
				type: Boolean,
				default: false
			},
			signInData: Object
		},
		data() {
			return {
				animation: {},
				animationData: {}
			}
		},
		mounted() {
			this.$nextTick(() => {
				this.turnAnimation()
			})
		},
		methods: {
			close() {
				this.$emit('close')
			},
			toCalendar() {
				uni.navigateTo({
					url: '/pages/user/calender'
				})
				this.close()
			},
			// 翻转动画
			turnAnimation() {
				var animation = uni.createAnimation({
					duration: 800,
					timingFunction: 'ease-in', //linear 全程匀速运动  ease 动画以低速开始，然后加快，在结束前变慢
				})
				this.animation = animation
				animation.scale(1, 1).rotateY(-45).step()
				// animation.rotateY(45).step({
				// 	duration: 500
				// })
				// animation.rotateY(0).step({
				// 	duration: 300
				// })
				this.animationData = animation.export()
			}
		}
	}
</script>

<style scoped lang="scss">
	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		.rect {
			width: 590rpx;
			height: 640rpx;
			perspective: 1000;
			border-radius: 20rpx;
			transform-style: preserve-3d;
			position: relative;
			z-index: 99999;
			.front {
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				transition: all 1s;
				background-color: greenyellow;
				padding: 60rpx;
				border-radius: 20rpx;
				box-sizing: border-box;
				z-index: 99999;
				.close {
					position: absolute;
					top: 11rpx;
					right: 11rpx;
				}
				.title{
					font-size: 20px;
					.green{
						color: #20C566;
					}
				}
				
				.sign-image {
					margin-top: 60rpx;
					image{
						width: 233rpx;
						height: 233rpx;
					}
				}
			}
			.back{
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				transition: all 1s;
				background-color: #fff;
				padding: 60rpx;
				border-radius: 20rpx;
				box-sizing: border-box;
			}
		}
	}
</style>
